package cn.lfy.studentmanager.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.lfy.studentmanager.dao.AcademyDao;
import cn.lfy.studentmanager.domain.Academy;
import cn.lfy.studentmanager.domain.Student;
import cn.lfy.studentmanager.service.AcademyService;

//此处注意要使用注解，这样才知道用到前面的service接口
@Service
public class AcademyServiceImpl implements AcademyService{
//这就是service接口实现类
	//注解注入dao,service调用dao，dao才是真正操作数据库的
	@Autowired
	private AcademyDao academyDao;
	 
	
	@Override
	public boolean add(Academy academy) {
		// TODO Auto-generated method stub
		return academyDao.add(academy);
	}
	@Override
	public List<Academy> select(int page, int limit) {
		return academyDao.select((page-1)*limit,limit);
	}
	@Override
	public boolean delete(int id) {
		boolean isSuccess;
		try {
			isSuccess = academyDao.delete(id);
		} catch (Exception e) {
			return false;
		}
		return isSuccess;
		//返回dao中delete的处理结果
	}
	@Override
	public boolean update(int id,String name){
		// TODO Auto-generated method stub
		return academyDao.update(id,name);
	}
	
	@Override
	public int getCount(){
		return academyDao.getCount();
	}


}
	
	

